﻿<%@ Page Language="C#" AutoEventWireup="true" EnableViewState="false" ValidateRequest="false" CodeBehind="Default.aspx.cs"
    Inherits="Web.View.publishNews.Default" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>{title}后台公共通知管理</title>
    <script src="/View/js/Alert.js" type="text/javascript"></script> 
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
    <!--{tablename}隐藏数据控件-->
    <ext:Hidden ID="ExcelGridData" runat="server" />
    <!--{tablename}页面主数据元，自动生成-->
    <ext:Store runat="server" ID="News_MainStore" OnRefreshData="News_InfoBind" AutoLoad="true">
        <Proxy>
            <ext:PageProxy />
        </Proxy>
        <Reader>
            <ext:JsonReader IDProperty="newsid">
                <Fields>
                    <ext:RecordField Name="newsid" />
                    <ext:RecordField Name="newsclassify" />
                    <ext:RecordField Name="newstitle" />
                    <ext:RecordField Name="newscontent" />
                    <ext:RecordField Name="newstime" />
                    <ext:RecordField Name="newsowner" />
                    <ext:RecordField Name="newsdesc" />
                </Fields>
            </ext:JsonReader>
        </Reader> 
        <BaseParams>
            <ext:Parameter Name="start" Value="0" Mode="Raw">
            </ext:Parameter>
            <ext:Parameter Name="limit" Value="15" Mode="Raw">
            </ext:Parameter>
        </BaseParams>
    </ext:Store>
    <!--{tablename}页面主表格-->
    <ext:Viewport ID="MainViewPort" runat="server">
        <Items>
            <ext:FitLayout>
                <Items>
                    <ext:GridPanel ID="News_Grid" Layout="fit" TrackMouseOver="true" runat="server" StoreID="News_MainStore"
                        StripeRows="true" Header="false" Border="false" Collapsible="true">
                        <TopBar>
                            <ext:Toolbar ID="MainToolBar" runat="server">
                                <Items>
                                    <ext:Button ID="BtnAdd" runat="server" Text="添加" Icon="Add">
                                        <DirectEvents>
                                            <Click OnEvent="BtnAdd_Click">
                                            </Click>
                                        </DirectEvents>
                                    </ext:Button>
                                    <ext:Button ID="BtnDel" runat="server" Text="删除" Icon="Delete">
                                        <DirectEvents>
                                            <Click OnEvent="BtnDel_Click">
                                                <Confirmation ConfirmRequest="true" Title="确认" Message="确实要删除吗?" />
                                                <EventMask ShowMask="true" Msg="正在删除数据，请等候 ..." />
                                            </Click>
                                        </DirectEvents>
                                        <Listeners>
                                            <Click Handler="if(#{News_Grid}.getSelectionModel().getCount()<=0) {TellAlert('请选择要删除的记录');return false;}" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:ToolbarSeparator />
                                    <ext:Button ID="BtnReload" runat="server" Text="重新加载" Icon="Reload">
                                        <Listeners>
                                            <Click Handler="#{News_MainStore}.reload();" />
                                        </Listeners>
                                    </ext:Button>
                                    <ext:ToolbarFill />
                                    <ext:Button ID="BtnToExcel" runat="server" Text="To Excel" AutoPostBack="true" OnClick="BtnSaveToExcel"
                                        Icon="PageExcel">
                                        <Listeners>
                                            <Click Handler="#{ExcelGridData}.setValue(Ext.encode(News_Grid.getRowsValues(false)));" />
                                        </Listeners>
                                        <ToolTips>
                                            <ext:ToolTip Title="将当前页内容存储为Excel文件">
                                            </ext:ToolTip>
                                        </ToolTips>
                                    </ext:Button>
                                </Items>
                            </ext:Toolbar>
                        </TopBar>
                        <ColumnModel ID="News_ColumnMode" runat="server">
                            <Columns>
                                <ext:RowNumbererColumn Width="20" />
                                <ext:Column Header="主键" Sortable="true" Hidden="true" DataIndex="newsid" />
                                <ext:Column Header="类别" Sortable="true" DataIndex="newsclassify" />
                                <ext:Column Header="标题" Sortable="true" DataIndex="newstitle" Width="400px" />
                                <ext:Column Header="发布时间" Sortable="true" DataIndex="newstime" Width="120px" />
                                <ext:Column Header="发布人" Sortable="true" DataIndex="newsowner" />
                                <ext:Column Header="备注" Sortable="true" DataIndex="newsdesc" />
                            </Columns>
                        </ColumnModel>
                        <Plugins>
                            <ext:GridFilters runat="server" FiltersText="查找" ID="News_Filter">
                                <Filters>
                                    <ext:StringFilter DataIndex="newsclassify" />
                                    <ext:StringFilter DataIndex="newstitle" />
                                    <ext:StringFilter DataIndex="newsowner" />
                                    <ext:DateFilter DataIndex="newstime">
                                        <DatePickerOptions runat="server" TodayText="Now" />
                                    </ext:DateFilter>

                                </Filters>
                            </ext:GridFilters>
                        </Plugins>
                        <DirectEvents>
                            <RowDblClick OnEvent="News_GridDBClick">
                                <ExtraParams>
                                    <ext:Parameter Name="id" Value="#{News_Grid}.store.getAt(rowIndex).get('newsid')"
                                        Mode="Raw" />
                                </ExtraParams>
                            </RowDblClick>
                        </DirectEvents>
                        <LoadMask ShowMask="true" Msg="正在加载..." />
                        <SelectionModel>
                            <ext:CheckboxSelectionModel ID="CheckBoxGrid" runat="server" />
                        </SelectionModel>
                        <BottomBar>
                            <ext:PagingToolbar ID="PagingToolBar" StoreID="News_MainStore" PageSize="15" runat="server" />
                        </BottomBar>
                    </ext:GridPanel>
                </Items>
            </ext:FitLayout>
        </Items>
    </ext:Viewport>
    
    <!--{tablename}修改，添加主窗体-->
    <ext:Window ID="News_Win" Collapsible="true" Hidden="true" Modal="true"
        Maximizable="false" runat="server" Title="添加/修改记录" Icon="WorldEdit" Width="630" Height="400"
        Resizable="false" Html="">
    </ext:Window>
    </form>
</body>
</html>
